<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2018~2018 GoMaoMao [ http://www.gomaomao.com ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.gomaomao.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | 联系方式：GoMaoMao <vip.vvm@qq.com>
// +----------------------------------------------------------------------
// | github开源项目：https://gitee.com/gomaomao.com/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\miniprogram\controller\api;

use controller\BasicApi;
use think\Db;

class Index extends BasicApi
{
	function index()
	{
		$_param          = $this->param;
		$website         = Db::name('website')->where('id', $_param['website'])->find();
		$data['banner']  = explode('|', $website['banner']);
		$data['product'] = Db::name('document')
				->limit(0,8)
				->where('recommend = 1')
				->where('cover <> ""')
				->order('sort asc, id Desc')
				->select();
		$this->_result($data);
	}

	function website()
	{
		$_param            = $this->param;
		$website           = Db::name('website')->where('id', $_param['website'])->find();
		$website['banner'] = explode('|', $website['banner']);
		$this->_result($website);
	}
}